from nerdbot.cards.models import Index_card
from nerdbot.cards.models import Index_card_Form
from nerdbot.cards.models import Tag
from nerdbot.cards.models import Variable 
from nerdbot.cards.models import Restriction
from django.template import defaultfilters

import datetime

from django.contrib import admin


class Index_card_admin(admin.ModelAdmin):
	form = Index_card_Form
	#fields = ('title','tags', 'equation', 'variables', 'restrictions', 'details')
	#exclude = ('slug', 'author', 'pub_date')
	def save_model(self, request, obj, form, change):
		obj.slug = defaultfilters.slugify(obj.title)
		obj.pub_date = str(datetime.datetime.today())
		obj.author = request.user.username
		obj.save()
	
	
admin.site.register(Index_card, Index_card_admin)
admin.site.register(Tag)
admin.site.register(Variable)
admin.site.register(Restriction)